package com.bbx.api.util;

import android.content.Context;

import com.bbx.androidapi.util.SharedPreUtil;
import com.bbx.api.sdk.SDK;
import com.bbx.api.sdk.model.passanger.Token;
import com.bbx.api.sdk.net.base.JsonBuild;

public class SharedPreEncryptUtil extends SharedPreUtil {
	public static String time_stamp="time_stamp";
	public static String TokenAndUid = "TokenAndUid";
	public static String phone = "phone";
	public static String user_name = "user_name";
	public static String real_name = "real_name";
	public static String role_name = "role_name";
	public static String real_phone = "real_phone";
	public static String authority = "authority";
	public static String user_sex = "user_sex";
	public static String user_code = "user_code";
	public static String isFirstIn = "isFirstIn";
	public static String isMarkOnlineDialog = "isMarkOnlineDialog";
	/** 用于判断是否加载网络的未完成订单 */
	public static String isLoadOrder_ing = "isLoadOrder_ing";
	/**离线消息的start_id*/
	public static String start_id = "start_id";
	/**快件消息*/
	public static String weight_json="weight_json";
	public static String volume_json="volume_json";
	/**取消原因列表*/
	public static String cancel_reason_json="cancel_reason_json";
	/**线路*/
	public static String list_line_num="list_line_num";
	/**线路*/
	public static String list_line_cn="list_line_cn";
	/**市内城市下单类型*/
	public static String list_incity_type="list_incity_type";
	/**市内城市电话*/
	public static String list_incity_phone="list_incity_phone";
	/**市内城市*/
	public static String list_incity_cn="list_incity_cn";
	/**市内城市*/
	public static String list_incity_num="list_incity_num";
	/**公务车推荐事由标签*/
	public static String list_tag_msg="list_tag_msg";
	/**活动时间间隔*/
	public static String activity_interval="activity_interval";
	/**活动上一次显示时间*/
	public static String activity_show_time="activity_show_time";
	/**启动页*/
	public static String launch_page="launch_page";
	/**定位城市*/
	public static String locationcity="locationcity";
	/**定位省份*/
	public static String locationprovince="locationprovince";
	/**上次的经纬度*/
	public static String latitude="latitude";
	/**上次的经纬度*/
	public static String longitude="longitude";
	/**上次退出界面的订单类型。*/
	public static String order_type="order_type";
	/**城际市内出发地历史城市*/
	public static String historic_city_sn_satrt="historic_city_sn_satrt";
	/**城际市内目的地地历史城市*/
	public static String historic_city_sn_end="historic_city_sn_end";
	/**城际市内出发地历史城市*/
	public static String historic_city_cj_satrt="historic_city_cj_satrt";
	/**城际目的地地历史城市*/
	public static String historic_city_cj_end="historic_city_cj_end";

	/**
	 * 写入String加密类型的值
	 *  
	 * @param context
	 * @param name
	 *            名称
	 * @param value
	 *            值 
	 */
	public static void putStringEncryptValue(Context context, String name,
			Object object) {
		String encrypt_json = new JsonBuild().setModel((Token) object)
				.islocEncrypt(true).getJson();
		putStringValue(context, name, encrypt_json);
	}

	/**
	 * 读取String类型的值
	 * 
	 * @param context
	 * @param name
	 * @param defaultValue
	 * @return
	 */
	public static Token getStringEncryptValue(Context context, String name,
			String defaultValue) {
		String encrypt_value = getStringValue(context, name, defaultValue);
		if (encrypt_value.equals("")) {
			return null;
		} else {
			String dencrypt_value = SDK.aesDecrypt(encrypt_value);
			Token token = (Token) new JsonBuild().getData(Token.class,
					dencrypt_value);
			return token;
		}

	}
}
